package com.boot.web;


import com.boot.mapper.TrainInfoMapper;
import com.boot.service.ThirdService;
import com.boot.util.JsonUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;


/**
 * @author pan zhang
 */

@RestController
@RequestMapping(value = "/3")
public class ScreenThirdController {


    private static final Logger logger = LoggerFactory.getLogger(ScreenThirdController.class);


    @Autowired
    private ThirdService thirdService;


    @Autowired
    private TrainInfoMapper trainInfoMapper;

    @GetMapping("1")
    public String third1 () {
        return JsonUtil.serialize(thirdService.getEquNumber());
    }

    /**
     * @return
     */
    @GetMapping("1/1")
    public String third111() {

        return JsonUtil.serialize(thirdService.getEqupmentRates());
    }



    @GetMapping("2")
    public String third2 () {

        return JsonUtil.serialize(thirdService.getEquCove());
    }


    @GetMapping("3")
    public String third3 () {

        return JsonUtil.serialize(thirdService.getEquRate());
    }
    /**
     * @return
     */
    @GetMapping("3/1")
    public String third311() {

        return JsonUtil.serialize(thirdService.getEqupmentZones());
    }



    @GetMapping("4")
    public String third4 () {

        return JsonUtil.serialize(thirdService.getCottons());
    }



    @GetMapping("5")
    public String third15 () {

        return JsonUtil.serialize(thirdService.getFibres());
    }



    @GetMapping("6")
    public String third6 () {

        return JsonUtil.serialize(thirdService.getFibreCottonSupervises());
    }



    @GetMapping("7")
    public String third7 () {

        return JsonUtil.serialize(thirdService.getBrand());
    }
    @GetMapping("7/1")
    public String third711 (HttpServletRequest request) {

        String year =request.getParameter("year");

        logger.info("1/7  param year======{}",year);

        return JsonUtil.serialize(thirdService.getBrandAwardName(year));
    }



    @GetMapping("8")
    public String third8 () {

        return JsonUtil.serialize(thirdService.getBrandAwardRate());
    }

    @GetMapping("9")
    public String third9() {

        return JsonUtil.serialize(thirdService.getFibreZoneBrand());
    }

    /**
     *
     *
     * */
    @GetMapping("10")
    public String third10 () {

        return JsonUtil.serialize(trainInfoMapper.selectAll());
    }

    /**
     *
     *
     * */
    @GetMapping("11")
    public String third11() {

        return JsonUtil.serialize(thirdService.getTrains());
    }

    @GetMapping("12")
    public String third12() {

        return JsonUtil.serialize(thirdService.getStandardCreate());
    }

    /**
     *
     * 专利发明
     * */
    @GetMapping("13")
    public String third13() {
        logger.info("----------专利发明----------");

        return JsonUtil.serialize(thirdService.getPatentedInvention());
    }


    /**
     *
     * 科技进步
     *
     * */
    @GetMapping("14")
    public String third14() {

        return JsonUtil.serialize(thirdService.getTechnologyUps());
    }








}